#include "World.h"

namespace Gw2API{

World::World(std::string *id, std::string *name)
{
	if(id != 0)
		world_id = atoi(id->c_str());
	if(name != 0)
		world_name = *name;
}


World::~World(void)
{
}


int World::updateEventStats(std::vector<evtStat> stats){
	std::vector<evtStat>::iterator it;
	std::vector<Map>::iterator mi;
	int opCode = 0;
	
	it = stats.begin();
	if(world_id == it->world_id)
		return EVENT_UPDATE_ERROR_WRONGWORLD;
	while(it != stats.end()){
		for(mi = maps.begin(); mi != maps.end(); mi++){
			if(it->map_id == mi->getId()){
				opCode = mi->updateEvent(&it->event_id, &it->state);
				break;
			}
		}
		it++;
	}
	return opCode;
}
};